BaltechScript Protocol

Baltech Script is a small language to define simple actions the reader should execute. A Baltech Script consists of one or more commands processed sequentially when the script is run. Usually these actions are assigned to events such as ''card presentation'' or ''I/O port set to low'' in Autoread Mode based readers. Alternatively, the host can execute such a script via protocol using the AR.RunScript command.

A script has to be stored as a configuration value within the Scripts / Events Key, if it shall be assigned to an event. This configuration Key contains a list of all available configuration Values and the events assigned to them.

Script commands are never waiting or delaying execution. If they start a long running process (i.e. Toggle ), this process will be started asynchronously. This means that the script is not waiting until the corresponding command has finished.

Example

The following example describes a scenario in which the Baltech reader runs in Autoread Mode.

The script to be executed in case a presented card is deemed valid by the Baltech reader is stored in the Scripts / Events / OnAccepted configuration Value.

The desired script needs to decide if the pin labeled Input0 is low (logical false) or not:

This script takes the following form:

  1. IfIoPort Input0 (hex code 44 04)
  2. DefaultAction (hex code 04)
  3. IfIoPort Input0 Not (hex code 44 04 80)
  4. Toggle Beeper 3 5 (hex code 03 02 03 05)
  5. ToggleInverted GreenLed 1 30 (hex code 06 00 01 1E)

A second script is needed to ensure that the green LED is enabled after the reader powers up. As soon as the reader is initialized completely, the host protocol is activated. Thus the Scripts / Events / OnEnabledProtocol event can be used to trigger the second script:

Condition Stack

A condition stack, necessary for conditional execution of parts of a script, is included as a feature of the Baltech Script language. It consists of a list of flags which may be either false (=0) or true (=1). If the topmost flag is true, all subsequent commands will be executed. If the topmost flag is false, none of the subsequent commands is executed, except commands modifying the stack. When a script is started, the condition stack is always empty. Thus, all commands are executed. The following list summarizes all commands modifying the condition stack:

The architecture allows an inverse polish notation for complex boolean expressions such as:

Sample
If "global state variable 8" is true and "dip switch 3" is off do X

Global State Variables

To save a script's state, 16 so-called global state variables are available. These variables are flags which can be set or cleared within a script. They keep their state even after the execution of a script. Thus, the next script can access the flags set by the previous script.

Initially, all 16 global state variables are cleared (=0).

It is possible to modify these global variables via a script or to copy a variable onto the top of the Condition Stack and vice-versa. Please refer to the description of the SetVar, ClearVar, AssignVar and IfVar functions for detailed information.